home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_perl.idb / usr / freeware / catman / p_man / cat3 / Tie::Hash.Z / Tie::Hash
Encoding:
Text File  |  1998-10-28  |  4.9 KB  |  199 lines

  1.  
  2.  
  3.  
  4.      TTTTiiiieeee::::::::HHHHaaaasssshhhh((((3333))))    22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))      TTTTiiiieeee::::::::HHHHaaaasssshhhh((((3333))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.       Tie::Hash, Tie::StdHash - base class definitions for tied
  10.       hashes
  11.  
  12.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.           package NewHash;
  14.           require Tie::Hash;
  15.  
  16.           @ISA = (Tie::Hash);
  17.  
  18.           sub DELETE { ... }      # Provides needed method
  19.           sub CLEAR    { ... }          # Overrides inherited    method
  20.  
  21.  
  22.           package NewStdHash;
  23.           require Tie::Hash;
  24.  
  25.           @ISA = (Tie::StdHash);
  26.  
  27.           #    All methods provided by    default, define    only those needing overrides
  28.           sub DELETE { ... }
  29.  
  30.  
  31.           package main;
  32.  
  33.           tie %new_hash, 'NewHash';
  34.           tie %new_std_hash, 'NewStdHash';
  35.  
  36.  
  37.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  38.       This module provides some skeletal methods for hash-tying
  39.       classes. See the _p_e_r_l_t_i_e manpage for a list of the functions
  40.       required in order to tie a hash to a package.    The basic
  41.       TTTTiiiieeee::::::::HHHHaaaasssshhhh package provides a new method, as well as methods
  42.       TIEHASH, EXISTS and CLEAR. The TTTTiiiieeee::::::::SSSSttttddddHHHHaaaasssshhhh package provides
  43.       most methods required    for hashes in the _p_e_r_l_t_i_e manpage. It
  44.       inherits from    TTTTiiiieeee::::::::HHHHaaaasssshhhh, and causes tied hashes to behave
  45.       exactly like standard    hashes,    allowing for selective
  46.       overloading of methods. The new method is provided as
  47.       grandfathering in the    case a class forgets to    include    a
  48.       TIEHASH method.
  49.  
  50.       For developers wishing to write their    own tied hashes, the
  51.       required methods are briefly defined below. See the the
  52.       _p_e_r_l_t_i_e manpage section for more detailed descriptive, as
  53.       well as example code:
  54.  
  55.       TIEHASH classname, LIST
  56.            The method invoked by the command tie %hash, classname.
  57.            Associates a new    hash instance with the specified
  58.            class. LIST would represent additional arguments    (along
  59.            the lines of the    _A_n_y_D_B_M__F_i_l_e manpage and    compatriots)
  60.  
  61.  
  62.  
  63.      Page 1                        (printed 10/23/98)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      TTTTiiiieeee::::::::HHHHaaaasssshhhh((((3333))))    22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))      TTTTiiiieeee::::::::HHHHaaaasssshhhh((((3333))))
  71.  
  72.  
  73.  
  74.            needed to complete the association.
  75.  
  76.       STORE    this, key, value
  77.            Store datum _v_a_l_u_e into _k_e_y for the tied hash _t_h_i_s.
  78.  
  79.       FETCH    this, key
  80.            Retrieve    the datum in _k_e_y for the tied hash _t_h_i_s.
  81.  
  82.       FIRSTKEY this
  83.            Return the (key,    value) pair for    the first key in the
  84.            hash.
  85.  
  86.       NEXTKEY this,    lastkey
  87.            Return the next key for the hash.
  88.  
  89.       EXISTS this, key
  90.            Verify that _k_e_y exists with the tied hash _t_h_i_s.
  91.  
  92.       DELETE this, key
  93.            Delete the key _k_e_y from the tied    hash _t_h_i_s.
  94.  
  95.       CLEAR    this
  96.            Clear all values    from the tied hash _t_h_i_s.
  97.  
  98.      CCCCAAAAVVVVEEEEAAAATTTTSSSS
  99.       The the _p_e_r_l_t_i_e manpage documentation    includes a method
  100.       called DESTROY as a necessary    method for tied    hashes.
  101.       Neither TTTTiiiieeee::::::::HHHHaaaasssshhhh nor    TTTTiiiieeee::::::::SSSSttttddddHHHHaaaasssshhhh define a default for this
  102.       method. This is a standard for class packages, but may be
  103.       omitted in favor of a    simple default.
  104.  
  105.      MMMMOOOORRRREEEE IIIINNNNFFFFOOOORRRRMMMMAAAATTTTIIIIOOOONNNN
  106.       The packages relating    to various DBM-related implemetations
  107.       (_D_B__F_i_l_e, _N_D_B_M__F_i_l_e, etc.) show examples of general tied
  108.       hashes, as does the the _C_o_n_f_i_g manpage module. While these
  109.       do not utilize TTTTiiiieeee::::::::HHHHaaaasssshhhh, they serve as good working
  110.       examples.
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.      Page 2                        (printed 10/23/98)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      TTTTiiiieeee::::::::HHHHaaaasssshhhh((((3333))))    22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))      TTTTiiiieeee::::::::HHHHaaaasssshhhh((((3333))))
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.      Page 3                        (printed 10/23/98)
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.